package com.sixmac.service.impl;

import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.List;
import java.util.Map;

import com.sixmac.core.base.service.BaseService;
import com.sixmac.core.plugins.dao.Md;
import com.sixmac.core.toolbox.CMap;
import com.sixmac.core.toolbox.kit.JsonKit;
import com.sixmac.core.toolbox.support.Convert;
import com.sixmac.model.Examin;
import net.sf.json.JSONObject;
import org.junit.Test;
import org.springframework.stereotype.Service;
import com.sixmac.model.ClienUser;
import com.sixmac.service.ClienUserService;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * ClienUserServiceImpl
 * 2018-07-06 17:49:50
 *
 * @author Blade
 */
@Service
public class ClienUserServiceImpl extends BaseService<ClienUser> implements ClienUserService {


    public List<Map> mapList = null;

    public List<Map> inputFile() {
        InputStream inputStream = getClass().getClassLoader().getResourceAsStream("city.json");
        if (mapList != null) {
            return mapList;
        }
        try {
            List<Map> list = com.alibaba.fastjson.JSONObject.parseObject(inputStream, List.class);
            mapList = list;
            return list;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }



    @Override
    public boolean updateStatus(String ids, Integer status) {
        CMap map = CMap.init().set("status", status).set("ids", Convert.toIntArray(ids));
        boolean temp = updateBy("status = #{status}", "id in (#{join(ids)})", map);
        return temp;
    }

    @Override
    @SuppressWarnings("unchecked")
    public Map<String, Object> findOne(Object id) {
        return Md.selectOne("clienUser.findOne", CMap.init().set("id", id), Map.class);
    }

    @Test
    public void te() {

    }

}
